#include <iostream>
using namespace std;

class A {
  public:
    virtual void Show() const;
    virtual ~A();
};

class B : public A {
  public:
    void Show() const override;
};
void A::Show() const { cout << "Class A" << endl; }
A::~A() {}
void B::Show() const { cout << "Class B" << endl; }

static void Show(const A &obj) { obj.Show(); }

int main() {
    A a;
    B b;
    Show(a);
    Show(b);

    A *p;
    p = &a;
    p->Show();
    p = &b;
    p->Show();

    B *q;
    q = &b;
    q->Show();

    return 0;
}
